import React, { Component } from "react";
import { Redirect, Route } from "react-router-dom";
import { Childsun } from "./groundson/Childsun";
import Mynavlink from "../Mynavlink";
class Sun1 extends Component {
  state = {};
  render() {
    return (
      <>
        <p>孙组件1</p>
      </>
    );
  }
}
class Sun2 extends Component {
  render() {
    return (
      <>
        <Childsun />
      </>
    );
  }
}
export class Child2 extends Component {
  render() {
    return (
      <>
        <h3>子组件2</h3>
        <Mynavlink to="/child2/sun1">
          <button>孙组件1</button>
        </Mynavlink>
        <Mynavlink to="/child2/sun2">
          <button>孙组件2</button>
        </Mynavlink>
        <br />
        <h4>孙组件</h4>
        <br />
        <Route path="/child2/sun1" component={Sun1} />
        <Route path="/child2/sun2" component={Sun2} />
        <Redirect to="/child2/sun1" />
        <br />
        <br />
      </>
    );
  }
}
